class code7 {
    //组合
    List<List<Integer>> ret;
    List<Integer> path;
    public List<List<Integer>> combine(int n, int k) {
        ret = new ArrayList<>();
        path = new ArrayList<>();
        dfs(n,k,1);
        return ret;
    }
    public void dfs(int n,int k,int pos) {
        if(k==path.size()) {
            ret.add(new ArrayList<>(path));
            return;
        }
        for(int i=pos;i<=n;i++) {
            path.add(i);
            dfs(n,k,i+1);
            path.remove(path.size()-1);
        }
    }
}